package com.ai.controller.made;

import com.ai.common.CommonResponse;
import com.ai.entity.exam.AnswerBO;
import com.ai.entity.exam.ExamRecordPage;
import com.ai.entity.exam.MirrorExam;
import com.ai.service.made.MirrorExamService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author：xiaosheng
 * @Date：2024-07-01 17:50
 */
@RestController
@RequestMapping("/exam")
public class ExamQuestionController {


    @Resource
    MirrorExamService mirrorExamService;

    /**
     * 查询题目详情
     */
    @PostMapping("/getExamQuestionDetail")
    public CommonResponse getExamQuestionDetail(@RequestBody MirrorExam mirrorExam) {
        return mirrorExamService.select(mirrorExam);

    }

    /**
     * 提交试卷
     *
     * @param answerBO
     * @return
     */
    @PostMapping("/getScoreDetail")
    public CommonResponse getScoreDetail(@RequestBody AnswerBO answerBO) {
        return mirrorExamService.getScoreDetail(answerBO);
    }

    /**
     * 分页查询考试记录
     *
     * @param examRecordPage
     * @return
     */
    @PostMapping("/examRecordPage")
    public CommonResponse getExamRecordPage(@RequestBody ExamRecordPage examRecordPage) {
        return mirrorExamService.getExamRecordPage(examRecordPage);
    }


    @PostMapping("/getExamRecordByExamRecordId/{examRecordId}")
    public CommonResponse getExamRecordById(@PathVariable("examRecordId") Integer examRecordId) {
        return mirrorExamService.getExamRecordById(examRecordId);
    }


    @PostMapping("/getQuestionDetailsByQuestionId/{questionId}/{examRecordId}")
    public CommonResponse getQuestionDetailsByQuestionId(@PathVariable("questionId") Integer questionId, @PathVariable("examRecordId") Integer examRecordId) {
        return mirrorExamService.getQuestionDetailsByQuestionId(questionId, examRecordId);
    }
}
